package com.github.data_manage.domain.vo

import com.github.data_manage.util.PageUtil
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull

/**
 *@author CHN
 *@since 2024-08-10 10:39
 */
abstract class BasePageVoParam {

    @NotNull
    @Min(1)
    open var pageSize: Int= 20

    @NotNull
    @Min(1)
    open var pageNum: Int = 1

    open var sort: SortParam? = null

    open val offset: Int?
        get() = (PageUtil.buildPageNum(pageNum) -1) * PageUtil.buildPageSize(pageSize)

}
